import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;

public class TxHelper {

    //静态常量
    public final static String QUOTE_MARKET = "\"";
    //给定一个字符串，在前后各添加一个反斜杠(\)
    public static String quoteMarket(String content) {
        return QUOTE_MARKET + content + QUOTE_MARKET;
    }
    //从给定字符串content的末尾删除指定数量的字符
    public static StringBuilder truncEnding(StringBuilder content, int number) {
        return content.delete(content.length() - number, content.length());
    }

    public static String readTxt(String fileName) throws IOException {
        BufferedReader reader = new BufferedReader(new FileReader(fileName));
        StringBuilder sb = new StringBuilder();
        String line = reader.readLine();

        while(line!=null) {
            sb.append(line);
            line = reader.readLine();
        }
        reader.close();
        return sb.toString();
    }
}
